home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tcl8.0 / tests / fileName.test < prev    next >
Encoding:
Text File  |  1997-08-15  |  42.8 KB  |  1,436 lines  |  [TEXT/ALFA]

  1. # This file tests the filename manipulation routines.
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1995-1996 Sun Microsystems, Inc.
  8. #
  9. # See the file "license.terms" for information on usage and redistribution
  10. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11. #
  12. # SCCS: @(#) fileName.test 1.30 97/08/01 11:13:27
  13.  
  14. if {[string compare test [info procs test]] == 1} then {source defs}
  15.  
  16. if {[info commands testsetplatform] == {}} {
  17.     puts "This application hasn't been compiled with the \"testsetplatform\""
  18.     puts "command, so I can't test the filename conversion procedures."
  19.     return 
  20.  
  21. global env
  22. set platform [testgetplatform]
  23.  
  24. test filename-1.1 {Tcl_GetPathType: unix} {
  25.     testsetplatform unix
  26.     file pathtype /
  27. } absolute
  28. test filename-1.2 {Tcl_GetPathType: unix} {
  29.     testsetplatform unix
  30.     file pathtype /foo
  31. } absolute
  32. test filename-1.3 {Tcl_GetPathType: unix} {
  33.     testsetplatform unix
  34.     file pathtype foo
  35. } relative
  36. test filename-1.4 {Tcl_GetPathType: unix} {
  37.     testsetplatform unix
  38.     file pathtype c:/foo
  39. } relative
  40. test filename-1.5 {Tcl_GetPathType: unix} {
  41.     testsetplatform unix
  42.     file pathtype ~
  43. } absolute
  44. test filename-1.6 {Tcl_GetPathType: unix} {
  45.     testsetplatform unix
  46.     file pathtype ~/foo
  47. } absolute
  48. test filename-1.7 {Tcl_GetPathType: unix} {
  49.     testsetplatform unix
  50.     file pathtype ~foo
  51. } absolute
  52. test filename-1.8 {Tcl_GetPathType: unix} {
  53.     testsetplatform unix
  54.     file pathtype ./~foo
  55. } relative
  56.  
  57. test filename-2.1 {Tcl_GetPathType: mac, denerate names} {
  58.     testsetplatform mac
  59.     file pathtype /
  60. } relative
  61. test filename-2.2 {Tcl_GetPathType: mac, denerate names} {
  62.     testsetplatform mac
  63.     file pathtype /.
  64. } relative
  65. test filename-2.3 {Tcl_GetPathType: mac, denerate names} {
  66.     testsetplatform mac
  67.     file pathtype /..
  68. } relative
  69. test filename-2.4 {Tcl_GetPathType: mac, denerate names} {
  70.     testsetplatform mac
  71.     file pathtype //.//
  72. } relative
  73. test filename-2.5 {Tcl_GetPathType: mac, denerate names} {
  74.     testsetplatform mac
  75.     file pathtype //.//../.
  76. } relative
  77. test filename-2.6 {Tcl_GetPathType: mac, tilde names} {
  78.     testsetplatform mac
  79.     file pathtype ~
  80. } absolute
  81. test filename-2.7 {Tcl_GetPathType: mac, tilde names} {
  82.     testsetplatform mac
  83.     file pathtype ~:
  84. } absolute
  85. test filename-2.8 {Tcl_GetPathType: mac, tilde names} {
  86.     testsetplatform mac
  87.     file pathtype ~:foo
  88. } absolute
  89. test filename-2.9 {Tcl_GetPathType: mac, tilde names} {
  90.     testsetplatform mac
  91.     file pathtype ~/
  92. } absolute
  93. test filename-2.10 {Tcl_GetPathType: mac, tilde names} {
  94.     testsetplatform mac
  95.     file pathtype ~/foo
  96. } absolute
  97. test filename-2.11 {Tcl_GetPathType: mac, unix-style names} {
  98.     testsetplatform mac
  99.     file pathtype /foo
  100. } absolute
  101. test filename-2.12 {Tcl_GetPathType: mac, unix-style names} {
  102.     testsetplatform mac
  103.     file pathtype /./foo
  104. } absolute
  105. test filename-2.13 {Tcl_GetPathType: mac, unix-style names} {
  106.     testsetplatform mac
  107.     file pathtype /..//./foo
  108. } absolute
  109. test filename-2.14 {Tcl_GetPathType: mac, unix-style names} {
  110.     testsetplatform mac
  111.     file pathtype /foo/bar
  112. } absolute
  113. test filename-2.15 {Tcl_GetPathType: mac, unix-style names} {
  114.     testsetplatform mac
  115.     file pathtype foo/bar
  116. } relative
  117. test filename-2.16 {Tcl_GetPathType: mac, mac-style names} {
  118.     testsetplatform mac
  119.     file pathtype :
  120. } relative
  121. test filename-2.17 {Tcl_GetPathType: mac, mac-style names} {
  122.     testsetplatform mac
  123.     file pathtype :foo
  124. } relative
  125. test filename-2.18 {Tcl_GetPathType: mac, mac-style names} {
  126.     testsetplatform mac
  127.     file pathtype foo:
  128. } absolute
  129. test filename-2.19 {Tcl_GetPathType: mac, mac-style names} {
  130.     testsetplatform mac
  131.     file pathtype foo:bar
  132. } absolute
  133. test filename-2.20 {Tcl_GetPathType: mac, mac-style names} {
  134.     testsetplatform mac
  135.     file pathtype :foo:bar
  136. } relative
  137. test filename-2.21 {Tcl_GetPathType: mac, mac-style names} {
  138.     testsetplatform mac
  139.     file pathtype ::foo:bar
  140. } relative
  141. test filename-2.22 {Tcl_GetPathType: mac, mac-style names} {
  142.     testsetplatform mac
  143.     file pathtype ~foo
  144. } absolute
  145. test filename-2.23 {Tcl_GetPathType: mac, mac-style names} {
  146.     testsetplatform mac
  147.     file pathtype :~foo
  148. } relative
  149. test filename-2.24 {Tcl_GetPathType: mac, mac-style names} {
  150.     testsetplatform mac
  151.     file pathtype ~foo:
  152. } absolute
  153. test filename-2.25 {Tcl_GetPathType: mac, mac-style names} {
  154.     testsetplatform mac
  155.     file pathtype foo/bar:
  156. } absolute
  157. test filename-2.26 {Tcl_GetPathType: mac, mac-style names} {
  158.     testsetplatform mac
  159.     file pathtype /foo:
  160. } absolute
  161. test filename-2.27 {Tcl_GetPathType: mac, mac-style names} {
  162.     testsetplatform mac
  163.     file pathtype foo
  164. } relative
  165.  
  166. test filename-3.1 {Tcl_GetPathType: windows} {
  167.     testsetplatform windows
  168.     file pathtype /
  169. } volumerelative
  170. test filename-3.2 {Tcl_GetPathType: windows} {
  171.     testsetplatform windows
  172.     file pathtype \\
  173. } volumerelative
  174. test filename-3.3 {Tcl_GetPathType: windows} {
  175.     testsetplatform windows
  176.     file pathtype /foo
  177. } volumerelative
  178. test filename-3.4 {Tcl_GetPathType: windows} {
  179.     testsetplatform windows
  180.     file pathtype \\foo
  181. } volumerelative
  182. test filename-3.5 {Tcl_GetPathType: windows} {
  183.     testsetplatform windows
  184.     file pathtype c:/
  185. } absolute
  186. test filename-3.6 {Tcl_GetPathType: windows} {
  187.     testsetplatform windows
  188.     file pathtype c:\\
  189. } absolute
  190. test filename-3.7 {Tcl_GetPathType: windows} {
  191.     testsetplatform windows
  192.     file pathtype c:/foo
  193. } absolute
  194. test filename-3.8 {Tcl_GetPathType: windows} {
  195.     testsetplatform windows
  196.     file pathtype c:\\foo
  197. } absolute
  198. test filename-3.9 {Tcl_GetPathType: windows} {
  199.     testsetplatform windows
  200.     file pathtype c:
  201. } volumerelative
  202. test filename-3.10 {Tcl_GetPathType: windows} {
  203.     testsetplatform windows
  204.     file pathtype c:foo
  205. } volumerelative
  206. test filename-3.11 {Tcl_GetPathType: windows} {
  207.     testsetplatform windows
  208.     file pathtype foo
  209. } relative
  210. test filename-3.12 {Tcl_GetPathType: windows} {
  211.     testsetplatform windows
  212.     file pathtype //foo/bar
  213. } absolute
  214. test filename-3.13 {Tcl_GetPathType: windows} {
  215.     testsetplatform windows
  216.     file pathtype ~foo
  217. } absolute
  218. test filename-3.14 {Tcl_GetPathType: windows} {
  219.     testsetplatform windows
  220.     file pathtype ~
  221. } absolute
  222. test filename-3.15 {Tcl_GetPathType: windows} {
  223.     testsetplatform windows
  224.     file pathtype ~/foo
  225. } absolute
  226. test filename-3.16 {Tcl_GetPathType: windows} {
  227.     testsetplatform windows
  228.     file pathtype ./~foo
  229. } relative
  230.  
  231. test filename-4.1 {Tcl_SplitPath: unix} {
  232.     testsetplatform unix
  233.     file split /
  234. } {/}
  235. test filename-4.2 {Tcl_SplitPath: unix} {
  236.     testsetplatform unix
  237.     file split /foo
  238. } {/ foo}
  239. test filename-4.3 {Tcl_SplitPath: unix} {
  240.     testsetplatform unix
  241.     file split /foo/bar
  242. } {/ foo bar}
  243. test filename-4.4 {Tcl_SplitPath: unix} {
  244.     testsetplatform unix
  245.     file split /foo/bar/baz
  246. } {/ foo bar baz}
  247. test filename-4.5 {Tcl_SplitPath: unix} {
  248.     testsetplatform unix
  249.     file split foo/bar
  250. } {foo bar}
  251. test filename-4.6 {Tcl_SplitPath: unix} {
  252.     testsetplatform unix
  253.     file split ./foo/bar
  254. } {. foo bar}
  255. test filename-4.7 {Tcl_SplitPath: unix} {
  256.     testsetplatform unix
  257.     file split /foo/../././foo/bar
  258. } {/ foo .. . . foo bar}
  259. test filename-4.8 {Tcl_SplitPath: unix} {
  260.     testsetplatform unix
  261.     file split ../foo/bar
  262. } {.. foo bar}
  263. test filename-4.9 {Tcl_SplitPath: unix} {
  264.     testsetplatform unix
  265.     file split {}
  266. } {}
  267. test filename-4.10 {Tcl_SplitPath: unix} {
  268.     testsetplatform unix
  269.     file split .
  270. } {.}
  271. test filename-4.11 {Tcl_SplitPath: unix} {
  272.     testsetplatform unix
  273.     file split ../
  274. } {..}
  275. test filename-4.12 {Tcl_SplitPath: unix} {
  276.     testsetplatform unix
  277.     file split ../..
  278. } {.. ..}
  279. test filename-4.13 {Tcl_SplitPath: unix} {
  280.     testsetplatform unix
  281.     file split //foo
  282. } {/ foo}
  283. test filename-4.14 {Tcl_SplitPath: unix} {
  284.     testsetplatform unix
  285.     file split foo//bar
  286. } {foo bar}
  287. test filename-4.15 {Tcl_SplitPath: unix} {
  288.     testsetplatform unix
  289.     file split ~foo
  290. } {~foo}
  291. test filename-4.16 {Tcl_SplitPath: unix} {
  292.     testsetplatform unix
  293.     file split ~foo/~bar
  294. } {~foo ./~bar}
  295. test filename-4.17 {Tcl_SplitPath: unix} {
  296.     testsetplatform unix
  297.     file split ~foo/~bar/~baz
  298. } {~foo ./~bar ./~baz}
  299. test filename-4.18 {Tcl_SplitPath: unix} {
  300.     testsetplatform unix
  301.     file split foo/bar~/baz
  302. } {foo bar~ baz}
  303.  
  304. test filename-5.1 {Tcl_SplitPath: mac} {
  305.     testsetplatform mac
  306.     file split a:b
  307. } {a: b}
  308. test filename-5.2 {Tcl_SplitPath: mac} {
  309.     testsetplatform mac
  310.     file split a:b:c
  311. } {a: b c}
  312. test filename-5.3 {Tcl_SplitPath: mac} {
  313.     testsetplatform mac
  314.     file split a:b:c:
  315. } {a: b c}
  316. test filename-5.4 {Tcl_SplitPath: mac} {
  317.     testsetplatform mac
  318.     file split a:
  319. } {a:}
  320. test filename-5.5 {Tcl_SplitPath: mac} {
  321.     testsetplatform mac
  322.     file split a::
  323. } {a: ::}
  324. test filename-5.6 {Tcl_SplitPath: mac} {
  325.     testsetplatform mac
  326.     file split a:::
  327. } {a: :: ::}
  328. test filename-5.7 {Tcl_SplitPath: mac} {
  329.     testsetplatform mac
  330.     file split :a
  331. } {a}
  332. test filename-5.8 {Tcl_SplitPath: mac} {
  333.     testsetplatform mac
  334.     file split :a::
  335. } {a ::}
  336. test filename-5.9 {Tcl_SplitPath: mac} {
  337.     testsetplatform mac
  338.     file split :
  339. } {:}
  340. test filename-5.10 {Tcl_SplitPath: mac} {
  341.     testsetplatform mac
  342.     file split ::
  343. } {::}
  344. test filename-5.11 {Tcl_SplitPath: mac} {
  345.     testsetplatform mac
  346.     file split :::
  347. } {:: ::}
  348. test filename-5.12 {Tcl_SplitPath: mac} {
  349.     testsetplatform mac
  350.     file split a:::b
  351. } {a: :: :: b}
  352. test filename-5.13 {Tcl_SplitPath: mac} {
  353.     testsetplatform mac
  354.     file split /a:b
  355. } {/a: b}
  356. test filename-5.14 {Tcl_SplitPath: mac} {
  357.     testsetplatform mac
  358.     file split ~:
  359. } {~:}
  360. test filename-5.15 {Tcl_SplitPath: mac} {
  361.     testsetplatform mac
  362.     file split ~/:
  363. } {~/:}
  364. test filename-5.16 {Tcl_SplitPath: mac} {
  365.     testsetplatform mac
  366.     file split ~:foo
  367. } {~: foo}
  368. test filename-5.17 {Tcl_SplitPath: mac} {
  369.     testsetplatform mac
  370.     file split ~/foo
  371. } {~: foo}
  372. test filename-5.18 {Tcl_SplitPath: mac} {
  373.     testsetplatform mac
  374.     file split ~foo:
  375. } {~foo:}
  376. test filename-5.19 {Tcl_SplitPath: mac} {
  377.     testsetplatform mac
  378.     file split a:~foo
  379. } {a: :~foo}
  380. test filename-5.20 {Tcl_SplitPath: mac} {
  381.     testsetplatform mac
  382.     file split /
  383. } {:/}
  384. test filename-5.21 {Tcl_SplitPath: mac} {
  385.     testsetplatform mac
  386.     file split a:b/c
  387. } {a: :b/c}
  388. test filename-5.22 {Tcl_SplitPath: mac} {
  389.     testsetplatform mac
  390.     file split /foo
  391. } {foo:}
  392. test filename-5.23 {Tcl_SplitPath: mac} {
  393.     testsetplatform mac
  394.     file split /a/b
  395. } {a: b}
  396. test filename-5.24 {Tcl_SplitPath: mac} {
  397.     testsetplatform mac
  398.     file split /a/b/foo
  399. } {a: b foo}
  400. test filename-5.25 {Tcl_SplitPath: mac} {
  401.     testsetplatform mac
  402.     file split a/b
  403. } {a b}
  404. test filename-5.26 {Tcl_SplitPath: mac} {
  405.     testsetplatform mac
  406.     file split ./foo/bar
  407. } {: foo bar}
  408. test filename-5.27 {Tcl_SplitPath: mac} {
  409.     testsetplatform mac
  410.     file split ../foo/bar
  411. } {:: foo bar}
  412. test filename-5.28 {Tcl_SplitPath: mac} {
  413.     testsetplatform mac
  414.     file split {}
  415. } {}
  416. test filename-5.29 {Tcl_SplitPath: mac} {
  417.     testsetplatform mac
  418.     file split .
  419. } {:}
  420. test filename-5.30 {Tcl_SplitPath: mac} {
  421.     testsetplatform mac
  422.     file split ././
  423. } {: :}
  424. test filename-5.31 {Tcl_SplitPath: mac} {
  425.     testsetplatform mac
  426.     file split ././.
  427. } {: : :}
  428. test filename-5.32 {Tcl_SplitPath: mac} {
  429.     testsetplatform mac
  430.     file split ../
  431. } {::}
  432. test filename-5.33 {Tcl_SplitPath: mac} {
  433.     testsetplatform mac
  434.     file split ..
  435. } {::}
  436. test filename-5.34 {Tcl_SplitPath: mac} {
  437.     testsetplatform mac
  438.     file split ../..
  439. } {:: ::}
  440. test filename-5.35 {Tcl_SplitPath: mac} {
  441.     testsetplatform mac
  442.     file split //foo
  443. } {foo:}
  444. test filename-5.36 {Tcl_SplitPath: mac} {
  445.     testsetplatform mac
  446.     file split foo//bar
  447. } {foo bar}
  448. test filename-5.37 {Tcl_SplitPath: mac} {
  449.     testsetplatform mac
  450.     file split ~foo
  451. } {~foo:}
  452. test filename-5.38 {Tcl_SplitPath: mac} {
  453.     testsetplatform mac
  454.     file split ~
  455. } {~:}
  456. test filename-5.39 {Tcl_SplitPath: mac} {
  457.     testsetplatform mac
  458.     file split foo
  459. } {foo}
  460. test filename-5.40 {Tcl_SplitPath: mac} {
  461.     testsetplatform mac
  462.     file split ~/
  463. } {~:}
  464. test filename-5.41 {Tcl_SplitPath: mac} {
  465.     testsetplatform mac
  466.     file split ~foo/~bar
  467. } {~foo: :~bar}
  468. test filename-5.42 {Tcl_SplitPath: mac} {
  469.     testsetplatform mac
  470.     file split ~foo/~bar/~baz
  471. } {~foo: :~bar :~baz}
  472. test filename-5.43 {Tcl_SplitPath: mac} {
  473.     testsetplatform mac
  474.     file split foo/bar~/baz
  475. } {foo bar~ baz}
  476. test filename-5.44 {Tcl_SplitPath: mac} {
  477.     testsetplatform mac
  478.     file split a/../b
  479. } {a :: b}
  480. test filename-5.45 {Tcl_SplitPath: mac} {
  481.     testsetplatform mac
  482.     file split a/../../b
  483. } {a :: :: b}
  484. test filename-5.46 {Tcl_SplitPath: mac} {
  485.     testsetplatform mac
  486.     file split a/.././../b
  487. } {a :: : :: b}
  488. test filename-5.47 {Tcl_SplitPath: mac} {
  489.     testsetplatform mac
  490.     file split /../bar
  491. } {bar:}
  492. test filename-5.48 {Tcl_SplitPath: mac} {
  493.     testsetplatform mac
  494.     file split /./bar
  495. } {bar:}
  496. test filename-5.49 {Tcl_SplitPath: mac} {
  497.     testsetplatform mac
  498.     file split //.//.././bar
  499. } {bar:}
  500. test filename-5.50 {Tcl_SplitPath: mac} {
  501.     testsetplatform mac
  502.     file split /..
  503. } {:/..}
  504. test filename-5.51 {Tcl_SplitPath: mac} {
  505.     testsetplatform mac
  506.     file split //.//.././
  507. } {://.//.././}
  508.  
  509. test filename-6.1 {Tcl_SplitPath: win} {
  510.     testsetplatform win
  511.     file split /
  512. } {/}
  513. test filename-6.2 {Tcl_SplitPath: win} {
  514.     testsetplatform win
  515.     file split /foo
  516. } {/ foo}
  517. test filename-6.3 {Tcl_SplitPath: win} {
  518.     testsetplatform win
  519.     file split /foo/bar
  520. } {/ foo bar}
  521. test filename-6.4 {Tcl_SplitPath: win} {
  522.     testsetplatform win
  523.     file split /foo/bar/baz
  524. } {/ foo bar baz}
  525. test filename-6.5 {Tcl_SplitPath: win} {
  526.     testsetplatform win
  527.     file split foo/bar
  528. } {foo bar}
  529. test filename-6.6 {Tcl_SplitPath: win} {
  530.     testsetplatform win
  531.     file split ./foo/bar
  532. } {. foo bar}
  533. test filename-6.7 {Tcl_SplitPath: win} {
  534.     testsetplatform win
  535.     file split /foo/../././foo/bar
  536. } {/ foo .. . . foo bar}
  537. test filename-6.8 {Tcl_SplitPath: win} {
  538.     testsetplatform win
  539.     file split ../foo/bar
  540. } {.. foo bar}
  541. test filename-6.9 {Tcl_SplitPath: win} {
  542.     testsetplatform win
  543.     file split {}
  544. } {}
  545. test filename-6.10 {Tcl_SplitPath: win} {
  546.     testsetplatform win
  547.     file split .
  548. } {.}
  549. test filename-6.11 {Tcl_SplitPath: win} {
  550.     testsetplatform win
  551.     file split ../
  552. } {..}
  553. test filename-6.12 {Tcl_SplitPath: win} {
  554.     testsetplatform win
  555.     file split ../..
  556. } {.. ..}
  557. test filename-6.13 {Tcl_SplitPath: win} {
  558.     testsetplatform win
  559.     file split //foo
  560. } {/ foo}
  561. test filename-6.14 {Tcl_SplitPath: win} {
  562.     testsetplatform win
  563.     file split foo//bar
  564. } {foo bar}
  565. test filename-6.15 {Tcl_SplitPath: win} {
  566.     testsetplatform win
  567.     file split /\\/foo//bar
  568. } {//foo/bar}
  569. test filename-6.16 {Tcl_SplitPath: win} {
  570.     testsetplatform win
  571.     file split /\\/foo//bar
  572. } {//foo/bar}
  573. test filename-6.17 {Tcl_SplitPath: win} {
  574.     testsetplatform win
  575.     file split /\\/foo//bar
  576. } {//foo/bar}
  577. test filename-6.18 {Tcl_SplitPath: win} {
  578.     testsetplatform win
  579.     file split \\\\foo\\bar
  580. } {//foo/bar}
  581. test filename-6.19 {Tcl_SplitPath: win} {
  582.     testsetplatform win
  583.     file split \\\\foo\\bar/baz
  584. } {//foo/bar baz}
  585. test filename-6.20 {Tcl_SplitPath: win} {
  586.     testsetplatform win
  587.     file split c:/foo
  588. } {c:/ foo}
  589. test filename-6.21 {Tcl_SplitPath: win} {
  590.     testsetplatform win
  591.     file split c:foo
  592. } {c: foo}
  593. test filename-6.22 {Tcl_SplitPath: win} {
  594.     testsetplatform win
  595.     file split c:
  596. } {c:}
  597. test filename-6.23 {Tcl_SplitPath: win} {
  598.     testsetplatform win
  599.     file split c:\\
  600. } {c:/}
  601. test filename-6.24 {Tcl_SplitPath: win} {
  602.     testsetplatform win
  603.     file split c:/
  604. } {c:/}
  605. test filename-6.25 {Tcl_SplitPath: win} {
  606.     testsetplatform win
  607.     file split c:/./..
  608. } {c:/ . ..}
  609. test filename-6.26 {Tcl_SplitPath: win} {
  610.     testsetplatform win
  611.     file split ~foo
  612. } {~foo}
  613. test filename-6.27 {Tcl_SplitPath: win} {
  614.     testsetplatform win
  615.     file split ~foo/~bar
  616. } {~foo ./~bar}
  617. test filename-6.28 {Tcl_SplitPath: win} {
  618.     testsetplatform win
  619.     file split ~foo/~bar/~baz
  620. } {~foo ./~bar ./~baz}
  621. test filename-6.29 {Tcl_SplitPath: win} {
  622.     testsetplatform win
  623.     file split foo/bar~/baz
  624. } {foo bar~ baz}
  625. test filename-6.30 {Tcl_SplitPath: win} {
  626.     testsetplatform win
  627.     file split c:~foo
  628. } {c: ./~foo}
  629.  
  630. test filename-7.1 {Tcl_JoinPath: unix} {
  631.     testsetplatform unix
  632.     file join / a
  633. } {/a}
  634. test filename-7.2 {Tcl_JoinPath: unix} {
  635.     testsetplatform unix
  636.     file join a b
  637. } {a/b}
  638. test filename-7.3 {Tcl_JoinPath: unix} {
  639.     testsetplatform unix
  640.     file join /a c /b d
  641. } {/b/d}
  642. test filename-7.4 {Tcl_JoinPath: unix} {
  643.     testsetplatform unix
  644.     file join /
  645. } {/}
  646. test filename-7.5 {Tcl_JoinPath: unix} {
  647.     testsetplatform unix
  648.     file join a
  649. } {a}
  650. test filename-7.6 {Tcl_JoinPath: unix} {
  651.     testsetplatform unix
  652.     file join {}
  653. } {}
  654. test filename-7.7 {Tcl_JoinPath: unix} {
  655.     testsetplatform unix
  656.     file join /a/ b
  657. } {/a/b}
  658. test filename-7.8 {Tcl_JoinPath: unix} {
  659.     testsetplatform unix
  660.     file join /a// b
  661. } {/a/b}
  662. test filename-7.9 {Tcl_JoinPath: unix} {
  663.     testsetplatform unix
  664.     file join /a/./../. b
  665. } {/a/./.././b}
  666. test filename-7.10 {Tcl_JoinPath: unix} {
  667.     testsetplatform unix
  668.     file join ~ a
  669. } {~/a}
  670. test filename-7.11 {Tcl_JoinPath: unix} {
  671.     testsetplatform unix
  672.     file join ~a ~b
  673. } {~b}
  674. test filename-7.12 {Tcl_JoinPath: unix} {
  675.     testsetplatform unix
  676.     file join ./~a b
  677. } {./~a/b}
  678. test filename-7.13 {Tcl_JoinPath: unix} {
  679.     testsetplatform unix
  680.     file join ./~a ~b
  681. } {~b}
  682. test filename-7.14 {Tcl_JoinPath: unix} {
  683.     testsetplatform unix
  684.     file join ./~a ./~b
  685. } {./~a/~b}
  686. test filename-7.15 {Tcl_JoinPath: unix} {
  687.     testsetplatform unix
  688.     file join a . b
  689. } {a/./b}
  690. test filename-7.16 {Tcl_JoinPath: unix} {
  691.     testsetplatform unix
  692.     file join a . ./~b
  693. } {a/./~b}
  694. test filename-7.17 {Tcl_JoinPath: unix} {
  695.     testsetplatform unix
  696.     file join //a b
  697. } {/a/b}
  698. test filename-7.18 {Tcl_JoinPath: unix} {
  699.     testsetplatform unix
  700.     file join /// a b
  701. } {/a/b}
  702.  
  703. test filename-8.1 {Tcl_JoinPath: mac} {
  704.     testsetplatform mac
  705.     file join a b
  706. } {:a:b}
  707. test filename-8.2 {Tcl_JoinPath: mac} {
  708.     testsetplatform mac
  709.     file join :a b
  710. } {:a:b}
  711. test filename-8.3 {Tcl_JoinPath: mac} {
  712.     testsetplatform mac
  713.     file join a b:
  714. } {b:}
  715. test filename-8.4 {Tcl_JoinPath: mac} {
  716.     testsetplatform mac
  717.     file join a: :b
  718. } {a:b}
  719. test filename-8.5 {Tcl_JoinPath: mac} {
  720.     testsetplatform mac
  721.     file join a: :b:
  722. } {a:b}
  723. test filename-8.6 {Tcl_JoinPath: mac} {
  724.     testsetplatform mac
  725.     file join a :: b
  726. } {:a::b}
  727. test filename-8.7 {Tcl_JoinPath: mac} {
  728.     testsetplatform mac
  729.     file join a :: :: b
  730. } {:a:::b}
  731. test filename-8.8 {Tcl_JoinPath: mac} {
  732.     testsetplatform mac
  733.     file join a ::: b
  734. } {:a:::b}
  735. test filename-8.9 {Tcl_JoinPath: mac} {
  736.     testsetplatform mac
  737.     file join a: b:
  738. } {b:}
  739. test filename-8.10 {Tcl_JoinPath: mac} {
  740.     testsetplatform mac
  741.     file join /a/b
  742. } {a:b}
  743. test filename-8.11 {Tcl_JoinPath: mac} {
  744.     testsetplatform mac
  745.     file join /a/b c/d
  746. } {a:b:c:d}
  747. test filename-8.12 {Tcl_JoinPath: mac} {
  748.     testsetplatform mac
  749.     file join /a/b :c:d
  750. } {a:b:c:d}
  751. test filename-8.13 {Tcl_JoinPath: mac} {
  752.     testsetplatform mac
  753.     file join ~ foo
  754. } {~:foo}
  755. test filename-8.14 {Tcl_JoinPath: mac} {
  756.     testsetplatform mac
  757.     file join :: ::
  758. } {:::}
  759. test filename-8.15 {Tcl_JoinPath: mac} {
  760.     testsetplatform mac
  761.     file join a: ::
  762. } {a::}
  763. test filename-8.16 {Tcl_JoinPath: mac} {
  764.     testsetplatform mac
  765.     file join a {} b
  766. } {:a:b}
  767. test filename-8.17 {Tcl_JoinPath: mac} {
  768.     testsetplatform mac
  769.     file join a::: b
  770. } {a:::b}
  771. test filename-8.18 {Tcl_JoinPath: mac} {
  772.     testsetplatform mac
  773.     file join a : : :
  774. } {:a}
  775. test filename-8.19 {Tcl_JoinPath: mac} {
  776.     testsetplatform mac
  777.     file join :
  778. } {:}
  779. test filename-8.20 {Tcl_JoinPath: mac} {
  780.     testsetplatform mac
  781.     file join : a
  782. } {:a}
  783. test filename-8.21 {Tcl_JoinPath: mac} {
  784.     testsetplatform mac
  785.     file join a: :b/c
  786. } {a:b/c}
  787. test filename-8.22 {Tcl_JoinPath: mac} {
  788.     testsetplatform mac
  789.     file join :a :b/c
  790. } {:a:b/c}
  791.  
  792. test filename-9.1 {Tcl_JoinPath: win} {
  793.     testsetplatform win
  794.     file join a b
  795. } {a/b}
  796. test filename-9.2 {Tcl_JoinPath: win} {
  797.     testsetplatform win
  798.     file join /a b
  799. } {/a/b}
  800. test filename-9.3 {Tcl_JoinPath: win} {
  801.     testsetplatform win
  802.     file join /a /b
  803. } {/b}
  804. test filename-9.4 {Tcl_JoinPath: win} {
  805.     testsetplatform win
  806.     file join c: foo
  807. } {c:foo}
  808. test filename-9.5 {Tcl_JoinPath: win} {
  809.     testsetplatform win
  810.     file join c:/ foo
  811. } {c:/foo}
  812. test filename-9.6 {Tcl_JoinPath: win} {
  813.     testsetplatform win
  814.     file join c:\\bar foo
  815. } {c:/bar/foo}
  816. test filename-9.7 {Tcl_JoinPath: win} {
  817.     testsetplatform win
  818.     file join /foo c:bar
  819. } {c:bar}
  820. test filename-9.8 {Tcl_JoinPath: win} {
  821.     testsetplatform win
  822.     file join ///host//share dir
  823. } {//host/share/dir}
  824. test filename-9.9 {Tcl_JoinPath: win} {
  825.     testsetplatform win
  826.     file join ~ foo
  827. } {~/foo}
  828. test filename-9.10 {Tcl_JoinPath: win} {
  829.     testsetplatform win
  830.     file join ~/~foo
  831. } {~/~foo}
  832. test filename-9.11 {Tcl_JoinPath: win} {
  833.     testsetplatform win
  834.     file join ~ ./~foo
  835. } {~/~foo}
  836. test filename-9.12 {Tcl_JoinPath: win} {
  837.     testsetplatform win
  838.     file join / ~foo
  839. } {~foo}
  840. test filename-9.13 {Tcl_JoinPath: win} {
  841.     testsetplatform win
  842.     file join ./a/ b c
  843. } {./a/b/c}
  844. test filename-9.14 {Tcl_JoinPath: win} {
  845.     testsetplatform win
  846.     file join ./~a/ b c
  847. } {./~a/b/c}
  848. test filename-9.15 {Tcl_JoinPath: win} {
  849.     testsetplatform win
  850.     file join // host share path
  851. } {/host/share/path}
  852. test filename-9.16 {Tcl_JoinPath: win} {
  853.     testsetplatform win
  854.     file join foo . bar
  855. } {foo/./bar}
  856. test filename-9.17 {Tcl_JoinPath: win} {
  857.     testsetplatform win
  858.     file join foo .. bar
  859. } {foo/../bar}
  860. test filename-9.18 {Tcl_JoinPath: win} {
  861.     testsetplatform win
  862.     file join foo/./bar
  863. } {foo/./bar}
  864.  
  865. test filename-10.1 {Tcl_TranslateFileName} {
  866.     testsetplatform unix
  867.     list [catch {testtranslatefilename foo} msg] $msg
  868. } {0 foo}
  869. test filename-10.2 {Tcl_TranslateFileName} {
  870.     testsetplatform windows
  871.     list [catch {testtranslatefilename {c:/foo}} msg] $msg
  872. } {0 {c:\foo}}
  873. test filename-10.3 {Tcl_TranslateFileName} {
  874.     testsetplatform windows
  875.     list [catch {testtranslatefilename {c:/\\foo/}} msg] $msg
  876. } {0 {c:\foo}}
  877. test filename-10.4 {Tcl_TranslateFileName} {
  878.     testsetplatform mac
  879.     list [catch {testtranslatefilename foo} msg] $msg
  880. } {0 :foo}
  881. test filename-10.5 {Tcl_TranslateFileName} {
  882.     testsetplatform mac
  883.     list [catch {testtranslatefilename :~foo} msg] $msg
  884. } {0 :~foo}
  885. test filename-10.6 {Tcl_TranslateFileName} {
  886.     global env
  887.     set temp $env(HOME)
  888.     set env(HOME) "/home/test"
  889.     testsetplatform unix
  890.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  891.     set env(HOME) $temp
  892.     set result
  893. } {0 /home/test/foo}
  894. test filename-10.7 {Tcl_TranslateFileName} {
  895.     global env
  896.     set temp $env(HOME)
  897.     unset env(HOME)
  898.     testsetplatform unix
  899.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  900.     set env(HOME) $temp
  901.     set result
  902. } {1 {couldn't find HOME environment variable to expand path}}
  903. test filename-10.8 {Tcl_TranslateFileName} {
  904.     global env
  905.     set temp $env(HOME)
  906.     set env(HOME) "/home/test"
  907.     testsetplatform unix
  908.     set result [list [catch {testtranslatefilename ~} msg] $msg]
  909.     set env(HOME) $temp
  910.     set result
  911. } {0 /home/test}
  912. test filename-10.9 {Tcl_TranslateFileName} {
  913.     global env
  914.     set temp $env(HOME)
  915.     set env(HOME) "/home/test/"
  916.     testsetplatform unix
  917.     set result [list [catch {testtranslatefilename ~} msg] $msg]
  918.     set env(HOME) $temp
  919.     set result
  920. } {0 /home/test}
  921. test filename-10.10 {Tcl_TranslateFileName} {
  922.     global env
  923.     set temp $env(HOME)
  924.     set env(HOME) "/home/test/"
  925.     testsetplatform unix
  926.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  927.     set env(HOME) $temp
  928.     set result
  929. } {0 /home/test/foo}
  930. test filename-10.11 {Tcl_TranslateFileName} {
  931.     global env
  932.     set temp $env(HOME)
  933.     set env(HOME) "Root:"
  934.     testsetplatform mac
  935.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  936.     set env(HOME) $temp
  937.     set result
  938. } {0 Root:foo}
  939. test filename-10.12 {Tcl_TranslateFileName} {
  940.     global env
  941.     set temp $env(HOME)
  942.     set env(HOME) "Root:home"
  943.     testsetplatform mac
  944.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  945.     set env(HOME) $temp
  946.     set result
  947. } {0 Root:home:foo}
  948. test filename-10.13 {Tcl_TranslateFileName} {
  949.     global env
  950.     set temp $env(HOME)
  951.     set env(HOME) "Root:home"
  952.     testsetplatform mac
  953.     set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
  954.     set env(HOME) $temp
  955.     set result
  956. } {0 Root:home::foo}
  957. test filename-10.14 {Tcl_TranslateFileName} {
  958.     global env
  959.     set temp $env(HOME)
  960.     set env(HOME) "Root:home"
  961.     testsetplatform mac
  962.     set result [list [catch {testtranslatefilename ~} msg] $msg]
  963.     set env(HOME) $temp
  964.     set result
  965. } {0 Root:home}
  966. test filename-10.15 {Tcl_TranslateFileName} {
  967.     global env
  968.     set temp $env(HOME)
  969.     set env(HOME) "Root:home:"
  970.     testsetplatform mac
  971.     set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
  972.     set env(HOME) $temp
  973.     set result
  974. } {0 Root:home::foo}
  975. test filename-10.16 {Tcl_TranslateFileName} {
  976.     global env
  977.     set temp $env(HOME)
  978.     set env(HOME) "Root:home::"
  979.     testsetplatform mac
  980.     set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
  981.     set env(HOME) $temp
  982.     set result
  983. } {0 Root:home:::foo}
  984. test filename-10.17 {Tcl_TranslateFileName} {
  985.     global env
  986.     set temp $env(HOME)
  987.     set env(HOME) "\\home\\"
  988.     testsetplatform windows
  989.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  990.     set env(HOME) $temp
  991.     set result
  992. } {0 {\home\foo}}
  993. test filename-10.18 {Tcl_TranslateFileName} {
  994.     global env
  995.     set temp $env(HOME)
  996.     set env(HOME) "\\home\\"
  997.     testsetplatform windows
  998.     set result [list [catch {testtranslatefilename ~/foo\\bar} msg] $msg]
  999.     set env(HOME) $temp
  1000.     set result
  1001. } {0 {\home\foo\bar}}
  1002. test filename-10.19 {Tcl_TranslateFileName} {
  1003.     global env
  1004.     set temp $env(HOME)
  1005.     set env(HOME) "c:"
  1006.     testsetplatform windows
  1007.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  1008.     set env(HOME) $temp
  1009.     set result
  1010. } {0 c:foo}
  1011. test filename-10.20 {Tcl_TranslateFileName} {
  1012.     list [catch {testtranslatefilename ~blorp/foo} msg] $msg
  1013. } {1 {user "blorp" doesn't exist}}
  1014. test filename-10.21 {Tcl_TranslateFileName} {
  1015.     global env
  1016.     set temp $env(HOME)
  1017.     set env(HOME) "c:\\"
  1018.     testsetplatform windows
  1019.     set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
  1020.     set env(HOME) $temp
  1021.     set result
  1022. } {0 {c:\foo}}
  1023. test filename-10.22 {Tcl_TranslateFileName} {
  1024.     testsetplatform windows
  1025.     list [catch {testtranslatefilename foo//bar} msg] $msg
  1026. } {0 {foo\bar}}
  1027.  
  1028. testsetplatform $platform
  1029.  
  1030. test filename-10.23 {Tcl_TranslateFileName} {nonPortable unixOnly} {
  1031.     # this test fails if ~ouster is not /home/ouster
  1032.     list [catch {testtranslatefilename ~ouster} msg] $msg
  1033. } {0 /home/ouster}
  1034. test filename-10.24 {Tcl_TranslateFileName} {nonPortable unixOnly} {
  1035.     # this test fails if ~ouster is not /home/ouster
  1036.     list [catch {testtranslatefilename ~ouster/foo} msg] $msg
  1037. } {0 /home/ouster/foo}
  1038.  
  1039.  
  1040. test filename-11.1 {Tcl_GlobCmd} {
  1041.     list [catch {glob} msg] $msg
  1042. } {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
  1043. test filename-11.2 {Tcl_GlobCmd} {
  1044.     list [catch {glob -gorp} msg] $msg
  1045. } {1 {bad switch "-gorp": must be -nocomplain or --}}
  1046. test filename-11.3 {Tcl_GlobCmd} {
  1047.     list [catch {glob -nocomplai} msg] $msg
  1048. } {1 {bad switch "-nocomplai": must be -nocomplain or --}}
  1049. test filename-11.4 {Tcl_GlobCmd} {
  1050.     list [catch {glob -nocomplain} msg] $msg
  1051. } {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
  1052. test filename-11.5 {Tcl_GlobCmd} {
  1053.     list [catch {glob -nocomplain ~xyqrszzz} msg] $msg
  1054. } {0 {}}
  1055. test filename-11.6 {Tcl_GlobCmd} {
  1056.     list [catch {glob ~xyqrszzz} msg] $msg
  1057. } {1 {user "xyqrszzz" doesn't exist}}
  1058. test filename-11.7 {Tcl_GlobCmd} {
  1059.     list [catch {glob -- -nocomplain} msg] $msg
  1060. } {1 {no files matched glob patterns "-nocomplain"}}
  1061. test filename-11.8 {Tcl_GlobCmd} {
  1062.     list [catch {glob -nocomplain -- -nocomplain} msg] $msg
  1063. } {0 {}}
  1064. test filename-11.9 {Tcl_GlobCmd} {
  1065.     testsetplatform unix
  1066.     list [catch {glob ~\\xyqrszzz/bar} msg] $msg
  1067. } {1 {globbing characters not supported in user names}}
  1068. test filename-11.10 {Tcl_GlobCmd} {
  1069.     testsetplatform unix
  1070.     list [catch {glob -nocomplain ~\\xyqrszzz/bar} msg] $msg
  1071. } {0 {}}
  1072. test filename-11.11 {Tcl_GlobCmd} {
  1073.     testsetplatform unix
  1074.     list [catch {glob ~xyqrszzz\\/\\bar} msg] $msg
  1075. } {1 {user "xyqrszzz" doesn't exist}}
  1076. test filename-11.12 {Tcl_GlobCmd} {
  1077.     testsetplatform unix
  1078.     set home $env(HOME)
  1079.     unset env(HOME)
  1080.     set x [list [catch {glob ~/*} msg] $msg]
  1081.     set env(HOME) $home
  1082.     set x
  1083. } {1 {couldn't find HOME environment variable to expand path}}
  1084.  
  1085. testsetplatform $platform
  1086.  
  1087. test filename-11.13 {Tcl_GlobCmd} {
  1088.     list [catch {file join [lindex [glob ~] 0]} msg] $msg
  1089. } [list 0 [file join $env(HOME)]]
  1090.  
  1091. set oldhome $env(HOME)
  1092. set env(HOME) [pwd]
  1093. file delete -force globTest
  1094. file mkdir globTest/a1/b1
  1095. file mkdir globTest/a1/b2
  1096. file mkdir globTest/a2/b3
  1097. file mkdir globTest/a3
  1098. close [open globTest/x1.c w]
  1099. close [open globTest/y1.c w]
  1100. close [open globTest/z1.c w]
  1101. close [open "globTest/weird name.c" w]
  1102. close [open globTest/a1/b1/x2.c w]
  1103. close [open globTest/a1/b2/y2.c w]
  1104.  
  1105. # Cannot create a file with the following names under Win32s.  We have to
  1106. # skip the tests that are checking the difference between a "." or "," in
  1107. # the file name vs. a "." or "," in the glob pattern.
  1108.  
  1109. catch {close [open globTest/.1 w]}
  1110. catch {close [open globTest/x,z1.c w]}
  1111.  
  1112. test filename-11.14 {Tcl_GlobCmd} {
  1113.     list [catch {glob ~/globTest} msg] $msg
  1114. } [list 0 [list [file join $env(HOME) globTest]]]
  1115. test filename-11.15 {Tcl_GlobCmd} {
  1116.     list [catch {glob ~\\/globTest} msg] $msg
  1117. } [list 0 [list [file join $env(HOME) globTest]]]
  1118. test filename-11.16 {Tcl_GlobCmd} {
  1119.     list [catch {glob globTest} msg] $msg
  1120. } {0 globTest}
  1121.  
  1122. test filename-12.1 {simple globbing} {unixOrPc} {
  1123.     list [catch {glob {}} msg] $msg
  1124. } {0 .}
  1125. test filename-12.2 {simple globbing} {macOnly} {
  1126.     list [catch {glob {}} msg] $msg
  1127. } {0 :}
  1128. test filename-12.3 {simple globbing} {
  1129.     list [catch {glob -nocomplain \{a1,a2\}} msg] $msg
  1130. } {0 {}}
  1131.  
  1132. if {$tcl_platform(platform) == "macintosh"} {
  1133.   set globPreResult :globTest:
  1134. } else {
  1135.   set globPreResult globTest/
  1136. }
  1137. set x1 x1.c
  1138. set y1 y1.c
  1139. test filename-12.4 {simple globbing} {unixOrPc} {
  1140.     lsort [glob globTest/x1.c globTest/y1.c globTest/foo]
  1141. } "$globPreResult$x1 $globPreResult$y1"
  1142. test filename-12.5 {simple globbing} {
  1143.     list [catch {glob globTest\\/x1.c} msg] $msg
  1144. } "0 $globPreResult$x1"
  1145. test filename-12.6 {simple globbing} {
  1146.     list [catch {glob globTest\\/\\x1.c} msg] $msg
  1147. } "0 $globPreResult$x1"
  1148.  
  1149. test filename-13.1 {globbing with brace substitution} {
  1150.     list [catch {glob globTest/\{\}} msg] $msg
  1151. } "0 $globPreResult"
  1152. test filename-13.2 {globbing with brace substitution} {
  1153.     list [catch {glob globTest/\{} msg] $msg
  1154. } {1 {unmatched open-brace in file name}}
  1155. test filename-13.3 {globbing with brace substitution} {
  1156.     list [catch {glob globTest/\{\\\}} msg] $msg
  1157. } {1 {unmatched open-brace in file name}}
  1158. test filename-13.4 {globbing with brace substitution} {
  1159.     list [catch {glob globTest/\{\\} msg] $msg
  1160. } {1 {unmatched open-brace in file name}}
  1161. test filename-13.5 {globbing with brace substitution} {
  1162.     list [catch {glob globTest/\}} msg] $msg
  1163. } {1 {unmatched close-brace in file name}}
  1164. test filename-13.6 {globbing with brace substitution} {
  1165.     list [catch {glob globTest/\{\}x1.c} msg] $msg
  1166. } "0 $globPreResult$x1"
  1167. test filename-13.7 {globbing with brace substitution} {
  1168.     list [catch {glob globTest/\{x\}1.c} msg] $msg
  1169. } "0 $globPreResult$x1"
  1170. test filename-13.8 {globbing with brace substitution} {
  1171.     list [catch {glob globTest/\{x\{\}\}1.c} msg] $msg
  1172. } "0 $globPreResult$x1"
  1173. test filename-13.9 {globbing with brace substitution} {!win32s} {
  1174.     list [lsort [catch {glob globTest/\{x,y\}1.c} msg]] $msg
  1175. } [list 0 [list $globPreResult$x1 $globPreResult$y1]]
  1176. test filename-13.10 {globbing with brace substitution} {!win32s} {
  1177.     list [lsort [catch {glob globTest/\{x,,y\}1.c} msg]] $msg
  1178. } [list 0 [list $globPreResult$x1 $globPreResult$y1]]
  1179. test filename-13.11 {globbing with brace substitution} {unixOrPc && !win32s} {
  1180.     list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
  1181. } {0 {globTest/x1.c globTest/x,z1.c globTest/z1.c}}
  1182. test filename-13.12 {globbing with brace substitution} {macOnly} {
  1183.     list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
  1184. } {0 {:globTest:x1.c :globTest:x,z1.c :globTest:z1.c}}
  1185. test filename-13.13 {globbing with brace substitution} {
  1186.     lsort [glob globTest/{a,b,x,y}1.c]
  1187. } [list $globPreResult$x1 $globPreResult$y1]
  1188. test filename-13.14 {globbing with brace substitution} {unixOrPc} {
  1189.     lsort [glob {globTest/{x1,y2,weird name}.c}]
  1190. } {{globTest/weird name.c} globTest/x1.c}
  1191. test filename-13.15 {globbing with brace substitution} {macOnly} {
  1192.     lsort [glob {globTest/{x1,y2,weird name}.c}]
  1193. } {{:globTest:weird name.c} :globTest:x1.c}
  1194. test filename-13.16 {globbing with brace substitution} {unixOrPc} {
  1195.     lsort [glob globTest/{x1.c,a1/*}]
  1196. } {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
  1197. test filename-13.17 {globbing with brace substitution} {macOnly} {
  1198.     lsort [glob globTest/{x1.c,a1/*}]
  1199. } {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
  1200. test filename-13.18 {globbing with brace substitution} {unixOrPc} {
  1201.     lsort [glob globTest/{x1.c,{a},a1/*}]
  1202. } {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
  1203. test filename-13.19 {globbing with brace substitution} {macOnly} {
  1204.     lsort [glob globTest/{x1.c,{a},a1/*}]
  1205. } {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
  1206. test filename-13.20 {globbing with brace substitution} {unixOrPc} {
  1207.     lsort [glob globTest/{a,x}1/*/{x,y}*]
  1208. } {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
  1209. test filename-13.21 {globbing with brace substitution} {macOnly} {
  1210.     lsort [glob globTest/{a,x}1/*/{x,y}*]
  1211. } {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
  1212. test filename-13.22 {globbing with brace substitution} {
  1213.     list [catch {glob globTest/\{a,x\}1/*/\{} msg] $msg
  1214. } {1 {unmatched open-brace in file name}}
  1215.  
  1216. test filename-14.1 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
  1217.     lsort [glob g*/*.c]
  1218. } {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
  1219. test filename-14.1 {asterisks, question marks, and brackets} {win32s} {
  1220.     lsort [glob g*/*.c]
  1221. } {globtest/weirdn~1.c globtest/x1.c globtest/y1.c globtest/z1.c}
  1222. test filename-14.2 {asterisks, question marks, and brackets} {macOnly} {
  1223.     lsort [glob g*/*.c]
  1224. } {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
  1225. test filename-14.3 {asterisks, question marks, and brackets} {unixOrPc} {
  1226.     lsort [glob globTest/?1.c]
  1227. } {globTest/x1.c globTest/y1.c globTest/z1.c}
  1228. test filename-14.4 {asterisks, question marks, and brackets} {macOnly} {
  1229.     lsort [glob globTest/?1.c]
  1230. } {:globTest:x1.c :globTest:y1.c :globTest:z1.c}
  1231. test filename-14.5 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
  1232.     lsort [glob */*/*/*.c]
  1233. } {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
  1234. test filename-14.5 {asterisks, question marks, and brackets} {win32s} {
  1235.     lsort [glob */*/*/*.c]
  1236. } {globtest/a1/b1/x2.c globtest/a1/b2/y2.c}
  1237. test filename-14.6 {asterisks, question marks, and brackets} {macOnly} {
  1238.     lsort [glob */*/*/*.c]
  1239. } {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
  1240. test filename-14.7 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
  1241.     lsort [glob globTest/*]
  1242. } {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
  1243. test filename-14.7 {asterisks, question marks, and brackets} {win32s} {
  1244.     lsort [glob globTest/*]
  1245. } {globTest/a1 globTest/a2 globTest/a3 globTest/weirdn~1.c globTest/x1.c globTest/y1.c globTest/z1.c}
  1246. test filename-14.8 {asterisks, question marks, and brackets} {macOnly} {
  1247.     lsort [glob globTest/*]
  1248. } {:globTest:.1 :globTest:a1 :globTest:a2 :globTest:a3 {:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
  1249. test filename-14.9 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
  1250.     lsort [glob globTest/.*]
  1251. } {globTest/. globTest/.. globTest/.1}
  1252. test filename-14.9 {asterisks, question marks, and brackets} {win32s} {
  1253.     lsort [glob globTest/.*]
  1254. } {globTest/. globTest/..}
  1255. test filename-14.10 {asterisks, question marks, and brackets} {macOnly} {
  1256.     lsort [glob globTest/.*]
  1257. } {:globTest:.1}
  1258. test filename-14.11 {asterisks, question marks, and brackets} {unixOrPc} {
  1259.     lsort [glob globTest/*/*]
  1260. } {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3}
  1261. test filename-14.12 {asterisks, question marks, and brackets} {macOnly} {
  1262.     lsort [glob globTest/*/*]
  1263. } {:globTest:a1:b1 :globTest:a1:b2 :globTest:a2:b3}
  1264. test filename-14.13 {asterisks, question marks, and brackets} {unixOrPc} {
  1265.     lsort [glob {globTest/[xyab]1.*}]
  1266. } {globTest/x1.c globTest/y1.c}
  1267. test filename-14.14 {asterisks, question marks, and brackets} {macOnly} {
  1268.     lsort [glob {globTest/[xyab]1.*}]
  1269. } {:globTest:x1.c :globTest:y1.c}
  1270. test filename-14.15 {asterisks, question marks, and brackets} {unixOrPc} {
  1271.     lsort [glob globTest/*/]
  1272. } {globTest/a1/ globTest/a2/ globTest/a3/}
  1273. test filename-14.16 {asterisks, question marks, and brackets} {macOnly} {
  1274.     lsort [glob globTest/*/]
  1275. } {:globTest:a1: :globTest:a2: :globTest:a3:}
  1276. test filename-14.17 {asterisks, question marks, and brackets} {
  1277.     global env
  1278.     set temp $env(HOME)
  1279.     set env(HOME) [file join $env(HOME) globTest]
  1280.     set result [list [catch {glob ~/z*} msg] $msg]
  1281.     set env(HOME) $temp
  1282.     set result
  1283. } [list 0 [list [file join $env(HOME) globTest z1.c]]]
  1284. test filename-14.18 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
  1285.     list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
  1286. } {0 {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}}
  1287. test filename-14.18 {asterisks, question marks, and brackets} {win32s} {
  1288.     list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
  1289. } {0 {globTest/weirdn~1.c globTest/x1.c globTest/y1.c globTest/z1.c}}
  1290. test filename-14.19 {asterisks, question marks, and brackets} {macOnly} {
  1291.     list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
  1292. } {0 {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}}
  1293. test filename-14.20 {asterisks, question marks, and brackets} {
  1294.     list [catch {glob -nocomplain goo/*} msg] $msg
  1295. } {0 {}}
  1296. test filename-14.21 {asterisks, question marks, and brackets} {
  1297.     list [catch {glob globTest/*/gorp} msg] $msg
  1298. } {1 {no files matched glob pattern "globTest/*/gorp"}}
  1299. test filename-14.22 {asterisks, question marks, and brackets} {
  1300.     list [catch {glob goo/* x*z foo?q} msg] $msg
  1301. } {1 {no files matched glob patterns "goo/* x*z foo?q"}}
  1302. test filename-14.23 {slash globbing} {unixOrPc} {
  1303.     glob /
  1304. } /
  1305. test filename-14.24 {slash globbing} {pcOnly} {
  1306.     glob {\\}
  1307. } /
  1308.  
  1309. # The following tests are only valid for Unix systems.
  1310.  
  1311. if {$tcl_platform(platform) == "unix"} {
  1312.     # On some systems, like AFS, "000" protection doesn't prevent
  1313.     # access by owner, so the following test is not portable.
  1314.  
  1315.     exec chmod 000 globTest
  1316.     test filename-15.1 {unix specific globbing} {nonPortable} {
  1317.     string tolower [list [catch {glob globTest/*} msg]  $msg $errorCode]
  1318.     } {1 {couldn't read directory "globtest": permission denied} {posix eacces {permission denied}}}
  1319.     exec chmod 755 globTest
  1320.     test filename-15.2 {unix specific globbing} {nonPortable} {
  1321.     glob ~ouster/.csh*
  1322.     } "/home/ouster/.cshrc"
  1323.     close [open globTest/odd\\\[\]*?\{\}name w]
  1324.     test filename-15.3 {unix specific globbing} {
  1325.     global env
  1326.     set temp $env(HOME)
  1327.     set env(HOME) $env(HOME)/globTest/odd\\\[\]*?\{\}name
  1328.     set result [list [catch {glob ~} msg] $msg]
  1329.     set env(HOME) $temp
  1330.     set result
  1331.     } [list 0 [list [glob ~]/globTest/odd\\\[\]*?\{\}name]]
  1332.     exec rm -f globTest/odd\\\[\]*?\{\}name
  1333. }
  1334.  
  1335. # The following tests are only valid for Windows systems.
  1336.  
  1337. if {$tcl_platform(platform) == "windows"} {
  1338.     set temp [pwd]
  1339.     cd c:/
  1340.     catch {
  1341.     removeDirectory globTest
  1342.     makeDirectory globTest
  1343.     close [open globTest/x1.BAT w]
  1344.     close [open globTest/y1.Bat w]
  1345.     close [open globTest/z1.bat w]
  1346.     }
  1347.     
  1348.     test filename-16.1 {windows specific globbing} {!win32s} {
  1349.     lsort [glob globTest/*.bat]
  1350.     } {globTest/x1.BAT globTest/y1.Bat globTest/z1.bat}
  1351.     test filename-16.1 {windows specific globbing} {win32s} {
  1352.     lsort [glob globTest/*.bat]
  1353.     } {globTest/x1.bat globTest/y1.bat globTest/z1.bat}
  1354.     test filename-16.2 {windows specific globbing} {
  1355.     glob c:
  1356.     } c:
  1357.     test filename-16.3 {windows specific globbing} {
  1358.     glob c:\\\\
  1359.     } c:/
  1360.     test filename-16.4 {windows specific globbing} {
  1361.     glob c:/
  1362.     } c:/
  1363.     test filename-16.5 {windows specific globbing} {!win32s} {
  1364.     glob c:*Test
  1365.     } c:globTest
  1366.     test filename-16.5 {windows specific globbing} {win32s} {
  1367.     glob c:*Test
  1368.     } c:globtest
  1369.     test filename-16.6 {windows specific globbing} {!win32s} {
  1370.     glob c:\\\\*Test
  1371.     } c:/globTest
  1372.     test filename-16.6 {windows specific globbing} {win32s} {
  1373.     glob c:\\\\*Test
  1374.     } c:/globtest
  1375.     test filename-16.7 {windows specific globbing} {!win32s} {
  1376.     glob c:/*Test
  1377.     } c:/globTest
  1378.     test filename-16.7 {windows specific globbing} {win32s} {
  1379.     glob c:/*Test
  1380.     } c:/globtest
  1381.     test filename-16.8 {windows specific globbing} {!win32s} {
  1382.     lsort [glob c:globTest/*.bat]
  1383.     } {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
  1384.     test filename-16.8 {windows specific globbing} {win32s} {
  1385.     lsort [glob c:globTest/*.bat]
  1386.     } {c:globTest/x1.bat c:globTest/y1.bat c:globTest/z1.bat}
  1387.     test filename-16.9 {windows specific globbing} {!win32s} {
  1388.     lsort [glob c:/globTest/*.bat]
  1389.     } {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
  1390.     test filename-16.9 {windows specific globbing} {win32s} {
  1391.     lsort [glob c:/globTest/*.bat]
  1392.     } {c:/globTest/x1.bat c:/globTest/y1.bat c:/globTest/z1.bat}
  1393.     test filename-16.10 {windows specific globbing} {!win32s} {
  1394.     lsort [glob c:globTest\\\\*.bat]
  1395.     } {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
  1396.     test filename-16.10 {windows specific globbing} {win32s} {
  1397.     lsort [glob c:globTest\\\\*.bat]
  1398.     } {c:globTest/x1.bat c:globTest/y1.bat c:globTest/z1.bat}
  1399.     test filename-16.11 {windows specific globbing} {!win32s} {
  1400.     lsort [glob c:\\\\globTest\\\\*.bat]
  1401.     } {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
  1402.     test filename-16.11 {windows specific globbing} {win32s} {
  1403.     lsort [glob c:\\\\globTest\\\\*.bat]
  1404.     } {c:/globTest/x1.bat c:/globTest/y1.bat c:/globTest/z1.bat}
  1405.  
  1406.     removeDirectory globTest
  1407.  
  1408.     if {($testConfig(nonPortable) != 0) && [catch {cd //gaspode/d}] == 0} {
  1409.     removeDirectory globTest
  1410.     makeDirectory globTest
  1411.  
  1412.     close [open globTest/x1.BAT w]
  1413.     close [open globTest/y1.Bat w]
  1414.     close [open globTest/z1.bat w]
  1415.  
  1416.     test filename-16.12 {windows specific globbing} {
  1417.         glob //gaspode/d/*Test
  1418.     } //gaspode/d/globTest
  1419.     test filename-16.13 {windows specific globbing} {
  1420.         glob {\\\\gaspode\\d\\*Test}
  1421.     } //gaspode/d/globTest
  1422.  
  1423.     removeDirectory globTest
  1424.     }        
  1425.  
  1426.     cd $temp
  1427. }
  1428.  
  1429. removeDirectory globTest
  1430. set env(HOME) $oldhome
  1431.  
  1432. testsetplatform $platform
  1433. catch {unset oldhome platform temp result}
  1434. concat ""
  1435.